OBJ = interface.o censorwords.o utf8string.o acsmx.o 
LIB = libcensorinterface.a
HOMEDIR = ./

CXX	= g++ 
FLAG = -fPIC -g -Wall -O3 -Wno-deprecated -D_DEBUG -D_STAT 
CXX	+= $(FLAG)
DEF	= -D_TRACE
DEFS += -D_REENTRANT -D_GNU_SOURCE -finput-charset=UTF-8
GLOBINC	= -I$(HOMEDIR)/include/ 
GLOBLIB = -L$(HOMEDIR)/lib/

COMPILE = -ffunction-sections -fdata-sections
LINK = -Wl,--gc-sections

.PHONY : all clean

all : $(LIB) $(OBJ) $(EXE)
	mkdir -p $(HOMEDIR)/include/censorwords
	mkdir -p $(HOMEDIR)/lib
	cp -f interface.h $(HOMEDIR)/include/censorwords
	cp -f $(LIB) $(HOMEDIR)/lib/
	cp interface.h $(LIB) $(HOMEDIR)/swig

$(LIB) : $(OBJ)
	ar -crs $@ $^
interface.o : interface.cpp
	$(CXX) -c interface.cpp -lstdc++ 
censorwords.o : censorwords/censorwords.cpp
	$(CXX) -c censorwords/censorwords.cpp -I./censorwords -lstdc++ 
utf8string.o : censorwords/utf8string.cpp
	$(CXX) -c censorwords/utf8string.cpp -I./censorwords -lstdc++
acsmx.o : censorwords/acsmx.cpp
	$(CXX) -c censorwords/acsmx.cpp -I./censorwords -lstdc++

clean:
	rm -rf $(OBJ) $(LIB) $(EXE)

